HAL GENERIC macro migration

This section provides information about the HAL GENERIC macro migration.

HAL DBGMCU migration macros

Freeze and unfreeze peripherals

HAL1

HAL2

Description

In HAL1, freezing and unfreezing the clock of various peripherals was done using preprocessor macros.
In HAL2, this functionality has been encapsulated into a new **DBGMCU** driver with static inline functions for a more structured approach.

Example

#define __HAL_DBGMCU_FREEZE_<PERIPHERAL>()
#define __HAL_DBGMCU_UNFREEZE_<PERIPHERAL>()
__STATIC_INLINE void HAL_DBGMCU_<PERIPHERAL>_Freeze(void)
__STATIC_INLINE void HAL_DBGMCU_<PERIPHERAL>_UnFreeze(void)

Example with TIM3

HAL1

HAL2

#define __HAL_DBGMCU_FREEZE_TIM3()
#define __HAL_DBGMCU_UNFREEZE_TIM3()
__STATIC_INLINE void HAL_DBGMCU_TIM3_Freeze(void)
__STATIC_INLINE void HAL_DBGMCU_TIM3_UnFreeze(void)

HAL SYSCFG/SBS migration macros

Enable and disable floating point unit (FPU) interrupts

HAL1

HAL2

Example SBS

#define __HAL_SBS_FPU_INTERRUPT_ENABLE(__INTERRUPT__)
#define __HAL_SBS_FPU_INTERRUPT_DISABLE(__INTERRUPT__)
void HAL_SBS_EnableFPUIT(uint32_t floating_point)
void HAL_SBS_DisableFPUIT(uint32_t floating_point)

Example SYSCFG

#define __HAL_SYSCFG_FPU_INTERRUPT_ENABLE(__INTERRUPT__)
#define __HAL_SYSCFG_FPU_INTERRUPT_DISABLE(__INTERRUPT__)
void HAL_SYSCFG_EnableFPUIT(uint32_t floating_point)
void HAL_SYSCFG_DisableFPUIT(uint32_t floating_point)

Enable and lock break inputs

HAL1

HAL2

Example SBS

#define __HAL_SBS_BREAK_ECC_LOCK()
#define __HAL_SBS_BREAK_LOCKUP_LOCK()
#define __HAL_SBS_BREAK_PVD_LOCK()
#define __HAL_SBS_BREAK_SRAM_ECC_LOCK()
void HAL_SBS_EnableTIMBreakInputs(uint32_t break_input)

Example SYSCFG

#define __HAL_SYSCFG_BREAK_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_LOCKUP_LOCK()
#define __HAL_SYSCFG_BREAK_PVD_LOCK()
#define __HAL_SYSCFG_BREAK_RAM2PARITY_LOCK()
#define __HAL_SYSCFG_BREAK_AXISRAM_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_ITCM_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_DTCM_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_SRAM1_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_SRAM2_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_SRAM3_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_SRAM4_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_BKRAM_DBL_ECC_LOCK()
#define __HAL_SYSCFG_BREAK_CM7_LOCKUP_LOCK()
#define __HAL_SYSCFG_BREAK_FLASH_DBL_ECC_LOCK()
/* or */
#define __HAL_SYSCFG_BREAK_ENABLE(__BREAK__)
void HAL_SYSCFG_EnableTIMBreakInputs(uint32_t break_input)

Disable break inputs

HAL1

HAL2

Example SYSCFG

#define __HAL_SYSCFG_BREAK_DISABLE(__BREAK__)
Removed: The break condition cannot be disabled by software in HAL2.

Enable and disable Fast-mode Plus driving capability

HAL1

HAL2

Example SBS

#define __HAL_SBS_FASTMODEPLUS_ENABLE(__FASTMODEPLUS__)
#define __HAL_SBS_FASTMODEPLUS_DISABLE(__FASTMODEPLUS__)
void HAL_SBS_EnableFastModePlus(uint32_t fast_mode_plus)
void HAL_SBS_DisableFastModePlus(uint32_t fast_mode_plus)

Example SYSCFG

#define __HAL_SYSCFG_FASTMODEPLUS_ENABLE(__FASTMODEPLUS__)
#define __HAL_SYSCFG_FASTMODEPLUS_DISABLE(__FASTMODEPLUS__)
void HAL_SYSCFG_EnableFastModePlus(uint32_t fast_mode_plus)
void HAL_SYSCFG_DisableFastModePlus(uint32_t fast_mode_plus)

Check and clear SBS memories erase status flags

Check SBS Memories Erase Status Flags

In HAL2, this functionality is encapsulated into separated static inline functions for each flag,

declared in the Low Layer (LL).

HAL1

HAL2

Example

#define __HAL_SBS_GET_MEMORIES_ERASE_STATUS(__FLAG__)
__STATIC_INLINE uint32_t LL_SBS_IsActiveFlag_IPMEE(void)
__STATIC_INLINE uint32_t LL_SBS_IsActiveFlag_MCLR(void)

Clear SBS Memories Erase Status Flags

In HAL2, this functionality is encapsulated into separated static inline functions for each flag,

declared in the Low Layer (LL).

HAL1

HAL2

Example

#define __HAL_SBS_CLEAR_MEMORIES_ERASE_STATUS(__FLAG__)
__STATIC_INLINE void LL_SBS_ClearFlag_IPMEE(void)
__STATIC_INLINE void LL_SBS_ClearFlag_MCLR(void)

Related concept: Removal of hardware-related macros in HAL2


Memory address remap management

In HAL2, the functionality is encapsulated and merged into a function declared in the SYSCFG driver.

HAL1

HAL2

Example

#define __HAL_SYSCFG_REMAPMEMORY_FLASH()
#define __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH()
#define __HAL_SYSCFG_REMAPMEMORY_SRAM()
void HAL_SYSCFG_SetMemoryAddrRemap(hal_syscfg_memory_addr_remap_t memory_remap)

HAL1

HAL2

Example

#define __HAL_SYSCFG_GET_BOOT_MODE()
hal_syscfg_memory_addr_remap_t HAL_SYSCFG_GetMemoryAddrRemap(void)

IRDA environment selection

Set IRDA Environment

In HAL2, the functionality has been encapsulated and merged into a function declared in the SYSCFG driver.

HAL1

HAL2

Example

#define __HAL_SYSCFG_IRDA_ENV_SELECTION(__SOURCE__)
#define __HAL_SYSCFG_IRDA_OUT_POLARITY_SELECTION(__SEL__)
void HAL_SYSCFG_SetIRModulation(hal_syscfg_ir_mod_envelope_src_t *p_source,
hal_syscfg_ir_mod_out_polarity_t *p_polarity)

Get IRDA Environment

In HAL2, the functionality has been encapsulated into a single function declared in the SYSCFG driver.

HAL1

HAL2

Example

#define __HAL_SYSCFG_GET_IRDA_ENV_SELECTION()
#define __HAL_SYSCFG_GET_POLARITY()
void HAL_SYSCFG_GetIRModulation(hal_syscfg_ir_mod_envelope_src_t *p_source,
hal_syscfg_ir_mod_out_polarity_t *p_polarity)

Interrupt line configuration

In HAL2, the functionality has been encapsulated into a function declared in the SYSCFG driver.

HAL1

HAL2

Example

#define __HAL_GET_PENDING_IT(__SOURCE__)
hal_syscfg_it_request_status_t
HAL_SYSCFG_IsPendingITRequest(hal_syscfg_it_request_source_t source)

Flags management

HAL1

HAL2

Example

#define __HAL_SYSCFG_GET_FLAG(__FLAG__)
#define __HAL_SYSCFG_CLEAR_FLAG()
__STATIC_INLINE uint32_t HAL_SYSCFG_IsActiveFlag(uint32_t flag)
__STATIC_INLINE void HAL_SYSCFG_ClearFlag(uint32_t flag)

HAL Generic EXTI all lines check macro

HAL1

HAL2

Example

#define IS_EXTI_ALL_LINE(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic EXTI D1 line check macro

HAL1

HAL2

Example

#define IS_EXTI_D1_LINE(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic EXTI D2 line check macro

HAL1

HAL2

Example

#define IS_EXTI_D2_LINE(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic EXTI D3 line clear macro

HAL1

HAL2

Example

#define IS_EXTI_D3_CLEAR(__SOURCE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic EXTI D3 line check macro

HAL1

HAL2

Example

#define IS_EXTI_D3_LINE(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic EXTI edge line check macro

HAL1

HAL2

Example

#define IS_EXTI_EDGE_LINE(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic EXTI mode line check macro

HAL1

HAL2

Example

#define IS_EXTI_MODE_LINE(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic FMC SWAPBMAP mode check macro

HAL1

HAL2

Example

#define IS_FMC_SWAPBMAP_MODE(__MODE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic EXTI configuration line check macro

HAL1

HAL2

Example

#define IS_HAL_EXTI_CONFIG_LINE(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SBS code configuration check macro

HAL1

HAL2

Example

#define IS_SBS_CODE_CONFIG(__LINE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SBS EPOCH selection check macro

HAL1

HAL2

Example

#define IS_SBS_EPOCH_SELECTION(__SELECT__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SBS ethernet configuration check macro

HAL1

HAL2

Example

#define IS_SBS_ETHERNET_CONFIG(__CONFIG__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SBS memories erase flag check macro

HAL1

HAL2

Example

#define IS_SBS_MEMORIES_ERASE_FLAG(__FLAG__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SBS VDDIO code select check macro

HAL1

HAL2

Example

#define IS_SBS_VDDIO_CODE_SELECT(__SELECT__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SBS VDDO code select check macro

HAL1

HAL2

Example

#define IS_SBS_VDD_CODE_SELECT(__SELECT__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG ADC2ALT ROUT0 check macro

HAL1

HAL2

Example

#define IS_SYSCFG_ADC2ALT_ROUT0(__VALUE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG ADC2ALT ROUT1 check macro

HAL1

HAL2

Example

#define IS_SYSCFG_ADC2ALT_ROUT1(__VALUE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG ANALOG switch check macro

HAL1

HAL2

Example

#define IS_SYSCFG_ANALOG_SWITCH(__SWITCH__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG BOOT address check macro

HAL1

HAL2

Example

#define IS_SYSCFG_BOOT_ADDRESS(__ADDRESS__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG BOOT register check macro

HAL1

HAL2

Example

#define IS_SYSCFG_BOOT_REGISTER(__REGISTER__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG code configuration check macro

HAL1

HAL2

Example

#define IS_SYSCFG_CODE_CONFIG(__CONFIG__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG code select check macro

HAL1

HAL2

Example

#define IS_SYSCFG_CODE_SELECT(__SELECT__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG ethernet configuration check macro

HAL1

HAL2

Example

#define IS_SYSCFG_ETHERNET_CONFIG(__CONFIG__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG fast mode plus check macro

HAL1

HAL2

Example

#define IS_SYSCFG_FASTMODEPLUS(__PIN__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG switch state check macro

HAL1

HAL2

Example

#define IS_SYSCFG_SWITCH_STATE(__STATE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG VREFBUF high impedance check macro

HAL1

HAL2

Example

#define IS_SYSCFG_VREFBUF_HIGH_IMPEDANCE(__VALUE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG VREFBUF trimming check macro

HAL1

HAL2

Example

#define IS_SYSCFG_VREFBUF_TRIMMING(__VALUE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.


HAL Generic SYSCFG VREFBUF voltage scale check macro

HAL1

HAL2

Example

#define IS_SYSCFG_VREFBUF_VOLTAGE_SCALE(__SCALE__)

Removed in HAL2, used internally in HAL1 and do not affect user level operation.